/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package horizon.gui.component;

import horizon.graphics.RenderingContext;
import horizon.util.Vector2;
import java.awt.Color;
import java.awt.event.MouseEvent;

/**
 *
 * @author J_Laptop
 */
public class GuiLabel extends GuiComponent {

    String text;
    Color textColor;
    Color bgColor;

    public GuiLabel(String name, String text, Color textColor, Color bgColor, Vector2 size, Vector2 position) {
        super(name, size, position);
        this.text = text;
        this.textColor = textColor;
        this.bgColor = bgColor;
    }

    public Color getBgColor() {
        return bgColor;
    }

    public void setBgColor(Color bgColor) {
        this.bgColor = bgColor;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Color getTextColor() {
        return textColor;
    }

    public void setTextColor(Color textColor) {
        this.textColor = textColor;
    }

    @Override
    public void update(long elapsedTime) {
    }

    @Override
    public void render(RenderingContext r) {

        r.drawFilledRectangle(componentBox, bgColor);

        int strWidth = r.getGraphics().getFontMetrics().stringWidth(text);

        r.drawText(text, position.add(size.div(2)).sub(new Vector2(strWidth / 2, 0)), textColor);


    }

    @Override
    public void onActivate(MouseEvent e) {
       
    }

    
}
